<include file="Public:header" />
<div class="_body bs-docs-container">
  <div class="row">
    <p class="red_title">投票要求</p>
    <p class="rules">{$data.rules}</p>
    <p class="red_title">投票专区</p>
    <form name="form" method="post" action="__URL__/subVote">
    <div class="er_title"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
      <label class="black_title">个人奖</label>
    </div>
    <volist name="personal" id="vo">
      <div class="product"> <a title="" href="__URL__/detail?id={$vo.id}&activity_id={$data.id}"><img src="{$Think.config.IMG_PATH}{$vo.img}" alt="" /></a>
        <div class="checkbox">
          <label>
            <input name="u_id[]" id="p{$vo.id}" type="checkbox" value="{$vo.id}" onclick="personalChecked({$vo.id})">
            {$vo.name} </label>
        </div>
        <div class="votes">已获得票数：{$vo.vote_num}</div>
      </div>
    </volist>
    
    <div class="clear"></div>
    <div class="cut_off"></div>
    <div class="er_title"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
      <label class="black_title">集体奖</label>
    </div>
    <volist name="team" id="vo">
      <div class="t_product"> <a title="" href="__URL__/detail?id={$vo.id}&activity_id={$data.id}"><img src="{$Think.config.IMG_PATH}{$vo.img}" alt="" /></a>
        <div class="checkbox">
          <label>
            <input name="u_id[]" id="t{$vo.id}" type="checkbox" value="{$vo.id}" onclick="teamChecked({$vo.id})">
            {$vo.name} </label>
        </div>
        <div class="votes">已获得票数：{$vo.vote_num}</div>
      </div>
    </volist>
    
    <div class="clear"></div>
    <div class="voting_district">
    
    	验证码：
        <input type="text" id="verify" name="verify" class="input_text" placeholder="验证码">
        <img src="__APP__/Index/verify/" onClick="fleshVerify()" border="0" alt="点击刷新验证码" title="点击刷新验证码" align="absmiddle" id="verifyImg" />
      <br/><br/>
      <button type="button" onclick="aa()" class="btn btn-primary btn-lg">确认投票</button>
    <input type="hidden" name="activityId" value="{$data.id}">
    </div>
    </form>
  </div>
  
</div>
<include file="Public:footer" />
<script type="text/javascript">
function fleshVerify() {
    var timenow = new Date().getTime();
    $('#verifyImg').attr("src", '__URL__/verify/' + timenow);
}

function aa() {

    var state = true;

    
    if (state) {
       $("form").submit();
    }
}


var personal = new Array(0);
var team = new Array();
var p_num = 0;
var t_num = 0;
//个人选中
function personalChecked(id){
	
	if($('#p'+id).is(':checked')) { 
		personal.push(id);
	}else{
		personal.pop();
	}
	
	p_num = personal.length;
}

//团队选中
function teamChecked(id){
	if($('#t'+id).is(':checked')) { 
		team.push(id);
	}else{
		team.pop();
	}
	
	t_num = team.length;	
}
</script>